import indexApi from '../../api/index.js';

const state = {
	categoryLists: [],
	newsLists: []
}

// getters
const getters = {
	
}

// actions
const actions = {
	getCategoryLists({
		commit
	}) {
		indexApi.getCategoryLists(lists => {
			commit('setCategoryLists', lists);
		})
	},
	getNewsLists({
		commit
	}) {
		indexApi.getNewsLists(lists => {
			commit('setNewsLists', lists);
		})
	}
}

// mutations
const mutations = {
	setCategoryLists(state, lists) {
		state.categoryLists = lists;
	},
	setNewsLists(state, lists) {
		state.newsLists = lists;
	},
}

export default {
	namespaced: true,
	state,
	getters,
	actions,
	mutations
}
